package com.qingcloud.adminbackend.entity.mqtt.detail;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * MQTT登录及Topic设置指令数据
 */
@Data
public class MqttTopic {

    @ApiModelProperty(value = "客户端ID,默认为设备编号")
    @JSONField(name = "clientID", ordinal = 3)
    private String clientId ;

    @ApiModelProperty(value = "MQTT登录名")
    @JSONField(name = "userName", ordinal = 4)
    private String userName;

    @ApiModelProperty(value = "MQTT登录密码")
    @JSONField(name = "passWord", ordinal = 5)
    private String password;

    @ApiModelProperty(value = "设备信息Topic(用于上电开机上传)")
    @JSONField(name = "devInfo", ordinal = 6)
    private String devInfo;

    @ApiModelProperty(value = "传感器数据上传Topic")
    @JSONField(name = "dataPost", ordinal = 7)
    private String dataPost;

    @ApiModelProperty(value = "属性参数上传Topic")
    @JSONField(name = "proPost", ordinal = 8)
    private String proPost;

    @ApiModelProperty(value = "属性参数设置Topic")
    @JSONField(name = "proSet", ordinal = 9)
    private String proSet;

    @ApiModelProperty(value = "事件上传Topic")
    @JSONField(name = "eventPost", ordinal = 10)
    private String eventPost;

    @ApiModelProperty(value = "固件升级请求Topic")
    @JSONField(name = "otaUpgrade", ordinal = 11)
    private String otaUpgrade;

    @ApiModelProperty(value = "固件升级进度Topic")
    @JSONField(name = "otaProgress", ordinal = 12)
    private String otaProgress;

    @ApiModelProperty(value = "固件版本上传Topic")
    @JSONField(name = "otaVersion", ordinal = 13)
    private String otaVersion;

    public String getClientId() {
        if(StringUtils.isEmpty(clientId)){
            return null;
        }
        return clientId;
    }

    public String getUserName() {
        if(StringUtils.isEmpty(userName)){
            return null;
        }
        return userName;
    }

    public String getPassword() {
        if(StringUtils.isEmpty(password)){
            return null;
        }
        return password;
    }
}
